#ifndef _SLEEP_LOCK_H
#define  _SLEEP_LOCK_H
#include "types.h"
#include "atomic.h"
// Long-term locks for processes
struct sleeplock {
  uint locked;       // Is the lock held?
  spinlock_t lk; // spinlock protecting this sleep lock

  // For debugging:
  char *name;        // Name of lock.
  int pid;           // Process holding lock
};

void
acquiresleep(struct sleeplock *lk);
void
releasesleep(struct sleeplock *lk);
int
holdingsleep(struct sleeplock *lk);
void
initsleeplock(struct sleeplock *lk, char *name);
#endif